<?php /*a:4:{s:56:"/www/wwwroot/ams/app/index/view/achievement/details.html";i:1589276517;s:50:"/www/wwwroot/ams/app/index/view/public/header.html";i:1588821168;s:48:"/www/wwwroot/ams/app/index/view/public/page.html";i:1589276120;s:50:"/www/wwwroot/ams/app/index/view/public/footer.html";i:1588833951;}*/ ?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <link rel="apple-touch-icon" sizes="76x76" href="/static/index/moban/assets/img/apple-icon.png">
    <link rel="icon" type="image/png" href="/static/index/moban/assets/img/favicon.png">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title>首页 | <?php echo htmlentities($system_name); ?></title>
    <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
        name='viewport' />
    <link href="/static/index/moban/assets/css/bootstrap.min.css" rel="stylesheet" />
    <link href="/static/index/moban/assets/css/now-ui-kit.css?v=1.1.0" rel="stylesheet" />
    <link href="/static/index/moban/assets/css/font-awesome.min.css" rel="stylesheet" />
</head>

<body class="index-page sidebar-collapse">

    <!-- 引入导航栏 -->
    <nav class="navbar navbar-expand-lg bg-info fixed-top">
    <div class="container">
        <div class="navbar-translate">
            <div class="navbar-brand text-white" style="font-size: 22px;"><?php echo htmlentities($system_name); ?></div>
            <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse"
                data-target="#example-navbar-info" aria-controls="navbarSupportedContent" aria-expanded="false"
                aria-label="Toggle navigation">
                <span class="navbar-toggler-bar bar1"></span>
                <span class="navbar-toggler-bar bar2"></span>
                <span class="navbar-toggler-bar bar3"></span>
            </button>
        </div>

        <div class="collapse navbar-collapse justify-content-end has-image" id="example-navbar-info">
            <ul class="navbar-nav">
                <li class="nav-item" style="float: right;">
                    <a class="nav-link" href="<?php echo url('index/index'); ?>">
                        <p style="font-size: 16px;">首页</p>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('index/notice_list'); ?>">
                        <p style="font-size: 16px;">更多资讯</p>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('index/link'); ?>">
                        <p style="font-size: 16px;">友情链接</p>
                    </a>
                </li>
                <?php if($user_info): ?>
                <li class="nav-item active">
                    <a class="nav-link" href="<?php echo url('User/index'); ?>">
                        <p><?php echo htmlentities($user_info->name); ?></p>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('Login/logout'); ?>">
                        <p>退出</p>
                    </a>
                </li>
                <?php else: if($registered): ?>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('Login/index'); ?>">
                        <p>登录</p>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('Login/register'); ?>">
                        <p>注册</p>
                    </a>
                </li>
                <?php else: ?>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('Login/index'); ?>">
                        <p>登录</p>
                    </a>
                </li>
                <?php endif; ?>
                <?php endif; ?>
            </ul>
        </div>
    </div>
</nav>
<!-- 向下推65像素 -->
<div style="height: 65px;"></div>

<!-- 防止闪屏 -->
<script src="/static/index/moban/assets/js/plugins/jquery.sharrre.js" type="text/javascript"></script>
<!-- Code JS File -->
<script src="/static/index/moban/assets/js/core/jquery.3.2.1.min.js" type="text/javascript"></script>
<script src="/static/index/moban/assets/js/core/popper.min.js" type="text/javascript"></script>
<script src="/static/index/moban/assets/js/core/bootstrap.min.js" type="text/javascript"></script>

<!-- 弹出层 -->
<script src="/static/admin/lib/layer/layer.js"></script>

<!-- 模板动作 -->
<script src="/static/index/moban/assets/js/now-ui-kit.js?v=1.1.0" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        // the body of this function is in assets/js/now-ui-kit.js
        nowuiKit.initSliders();
    });

    function scrollToDownload() {

        if ($('.section-download').length != 0) {
            $("html, body").animate({
                scrollTop: $('.section-download').offset().top
            }, 1000);
        }
    }
</script>

    <!-- 内容页 -->
    <div class="container" style="min-height: 490px;">
        <!-- 个人信息 -->
        <div class="row">
            <div class="col-md-12">
                <h3>成果详情 - <?php echo htmlentities($classify_info['name']); ?></h3>
            </div>

        </div>

        <div class="row">
            <div class="col-md-12">
                <button class="btn btn-info" onclick="add('<?php echo htmlentities($classify_table_info['cid']); ?>')">添加一条新纪录</button>
                <button class="btn btn-success" onclick="upload_template()">批量上传</button>
                <input type="file" id="file_upload" name="file_upload" style="display: none;"
                    accept="text/csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
                <button class="btn btn-success" onclick="download_template('<?php echo htmlentities($classify_info['id']); ?>')">模板下载</button>
                <button class="btn btn-success" onclick="achievement_import('<?php echo htmlentities($classify_info['id']); ?>')">成果导出</button>
                <button class="btn btn-danger" onclick="back('<?php echo htmlentities($uid); ?>')">返回上一页</button>
            </div>
            <div class="col-md-12">
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th style='vertical-align: middle;text-align: center;'>#</th>
                            <?php if(is_array($classify_table_info['table_content']['names']) || $classify_table_info['table_content']['names'] instanceof \think\Collection || $classify_table_info['table_content']['names'] instanceof \think\Paginator): $i = 0; $__LIST__ = $classify_table_info['table_content']['names'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$row): $mod = ($i % 2 );++$i;?>
                            <th style='vertical-align: middle;text-align: center;'><?php echo htmlentities($row); ?></th>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                            <th style="width:260px;vertical-align: middle;text-align: center;">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if(is_array($classify_table_other_data) || $classify_table_other_data instanceof \think\Collection || $classify_table_other_data instanceof \think\Paginator): $k = 0; $__LIST__ = $classify_table_other_data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$row): $mod = ($k % 2 );++$k;?>
                        <!-- 初始化一个变量 -->
                        <!-- <?php echo htmlentities($k=0); ?> -->
                        <tr>
                            <td style='vertical-align: middle;text-align: center;'><?php echo htmlentities($row['id']); ?></td>
                            <?php if(is_array($classify_table_info['table_content']['names']) || $classify_table_info['table_content']['names'] instanceof \think\Collection || $classify_table_info['table_content']['names'] instanceof \think\Paginator): $i = 0; $__LIST__ = $classify_table_info['table_content']['names'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$var): $mod = ($i % 2 );++$i;if($classify_type_list[$classify_table_info['table_content']['selects'][$k]-1]['name'] ==
                            '时间'): ?>
                            <td style='vertical-align: middle;text-align: center;'>
                                <?php echo htmlentities(date('Y-m-d',!is_numeric($row[$classify_table_info['table_content']['cols'][$k]])? strtotime($row[$classify_table_info['table_content']['cols'][$k]]) : $row[$classify_table_info['table_content']['cols'][$k]])); ?> </td>
                            <?php else: if($classify_type_list[$classify_table_info['table_content']['selects'][$k]-1]['name'] ==
                            '数值'): ?>
                            <td style='vertical-align: middle;text-align: center;'>
                                <?php echo htmlentities(floatval($row[$classify_table_info['table_content']['cols'][$k]] / 100)); ?> </td>
                            <?php else: ?>
                            <td style='vertical-align: middle;text-align: center;'>
                                <?php echo htmlentities($row[$classify_table_info['table_content']['cols'][$k]]); ?> </td>
                            <?php endif; ?>
                            <?php endif; ?>


                            <!-- $k 自增 -->
                            <!-- <?php echo htmlentities($k++); ?> -->
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                            <td style='vertical-align: middle;text-align: left;'>
                                <!-- 编辑按钮 -->
                                <?php if($row['status'] == 0 or $row['status'] == 3 or $row['status'] == 4): ?>
                                <button class="btn btn-info btn-round" type="button"
                                    onclick="edit('<?php echo htmlentities($row['pid']); ?>','<?php echo htmlentities($row['id']); ?>')">编辑</button>
                                <?php else: ?>
                                <button class="btn btn-default btn-round" type="button" disabled>编辑</button>
                                <?php endif; ?>

                                <!-- 状态按钮 -->
                                <?php if($row['status'] == 0): ?>
                                <button class="btn btn-primary btn-round" type="button"
                                    onclick="audit('<?php echo htmlentities($row['pid']); ?>','<?php echo htmlentities($row['id']); ?>')">
                                    <?php echo htmlentities(achievement_submit_status($row['status'])); ?>
                                </button>
                                <?php else: if($row['status'] == 4): ?>
                                <button class="btn btn-success btn-round" type="button">
                                    <?php echo htmlentities(achievement_submit_status($row['status'])); ?>
                                </button>
                                <?php else: ?>
                                <button class="btn btn-round" type="button">
                                    <?php echo htmlentities(achievement_submit_status($row['status'])); ?>
                                </button>
                                <?php endif; ?>
                                <?php endif; ?>

                                <!-- 删除按钮 -->
                                <?php if($row['status'] == 0 or $row['status'] == 3): ?>
                                <button class="btn btn-danger btn-round" type="button"
                                    onclick="del('<?php echo htmlentities($row['pid']); ?>','<?php echo htmlentities($row['id']); ?>')">删除</button>
                                <?php else: ?>
                                <button class="btn btn-default btn-round" type="button" disabled>删除</button>
                                <?php endif; ?>
                            </td>
                        </tr>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </tbody>
                </table>
            </div>
            <!-- 加载分页页面 -->
            <?php if($page_res['len']): ?>
<div class="col-md-12">
    <div class="pagination pagination-primary" style="display: inline-block; text-align: center;">
        <?php if(is_array($page_res['len']) || $page_res['len'] instanceof \think\Collection || $page_res['len'] instanceof \think\Paginator): $i = 0; $__LIST__ = $page_res['len'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$row): $mod = ($i % 2 );++$i;?>
        <div class="page-item <?php echo $page_res['p']==$row+1 ? 'active'  :  ''; ?>" style="float: left; ">
            <a class="page-link" href="<?php echo htmlentities($page_res['url']); ?>&p=<?php echo htmlentities($row); ?>"><?php echo htmlentities($row+1); ?></a>
        </div>
        <?php endforeach; endif; else: echo "" ;endif; ?>
    </div>
</div>
<?php endif; ?>

        </div>
    </div>
    <!-- 引入页脚 -->
    <footer class="footer " style="background-color: #ddd;">
    <div style="text-align: center;">
        Copyright © 2020 夏立军 山东建筑大学-<?php echo htmlentities($system_name); ?> 201611106025
    </div>
</footer>

    <script>

        // 添加一条记录
        function add(cid) {
            redirect_url("<?php echo url('Achievement/add'); ?>?cid=" + cid);
        }

        // 模板下载
        function download_template(cid) {
            $.ajax({
                url: "<?php echo url('Achievement/download_template'); ?>",
                data: {
                    'cid': cid,
                },
                type: "POST",
                dataType: "JSON",
                async: true,
                success: function (res) {
                    // 返回结果处理
                    if (res.code == 0) {
                        redirect_url(res.url);
                        return layer.msg(res.msg, { icon: 1, time: 900 });
                    } else {
                        return layer.msg(res.msg, { icon: 2, time: 900 });
                    }
                }
            });
        }

        // 批量上传
        function upload_template() {
            $('#file_upload').click();
        }

        // 上传
        $('#file_upload').change(function () {
            var files = $('#file_upload').prop('files');
            var data = new FormData();
            data.append('achievement_data', files[0]);
            data.append('cid', "<?php echo htmlentities($cid); ?>");
            var index_load = layer.load(1, {
                shade: [0.3, '#fff'] //0.1透明度的白色背景
            });
            // console.log(data);
            $.ajax({
                url: "<?php echo url('Achievement/upload_template'); ?>",
                data: data,
                type: "POST",
                dataType: "JSON",
                contentType: false,
                processData: false,
                success: function (res) {
                    layer.close(index_load);
                    if (res.code == 0) {
                        return layer.msg(res.msg, { icon: 1, time: 900 }, function () {
                            location.reload();
                        });
                    } else {
                        return layer.msg(res.msg, { icon: 2, time: 900 }, function () {
                            console.log(res.data)
                        });
                    }
                },
                error: function (res) {
                    console.log(res.responseText);
                }
            });

            $('#file_upload').val('');
        });

        // 返回指定的位置
        function back(uid) {
            redirect_url("<?php echo url('Achievement/index'); ?>?uid=" + uid);
        }

        // 删除成果
        function del(pid, id) {

            layer.confirm('是否要删除成果', {
                btn: ['是', '否'] //按钮
            }, function () {
                $.ajax({
                    url: "<?php echo url('Achievement/del'); ?>",
                    data: {
                        'pid': pid,
                        'id': id
                    },
                    type: "POST",
                    dataType: "JSON",
                    success: function (res) {
                        // 返回结果处理
                        if (res.code == 0) {
                            return layer.msg(res.msg, { icon: 1, time: 900 }, function () {
                                location.reload();
                            });
                        } else {
                            return layer.msg(res.msg, { icon: 2, time: 900 });
                        }
                    }
                });
            }, function () { });
        }

        // 编辑成果
        function edit(pid, id) {
            redirect_url("<?php echo url('Achievement/edit'); ?>?pid=" + pid + "&id=" + id);
        }

        // 提交审核
        function audit(pid, id) {

            layer.confirm('是否要提交审核', {
                btn: ['是', '否'] //按钮
            }, function () {
                $.ajax({
                    url: "<?php echo url('Achievement/audit'); ?>",
                    data: {
                        'pid': pid,
                        'id': id
                    },
                    type: "POST",
                    dataType: "JSON",
                    success: function (res) {
                        // 返回结果处理
                        if (res.code == 0) {
                            return layer.msg(res.msg, { icon: 1, time: 900 }, function () {
                                location.reload();
                            });
                        } else {
                            return layer.msg(res.msg, { icon: 2, time: 900 });
                        }
                    }
                });
            }, function () { });

        }

        // 成果导出
        function achievement_import(cid) {
            var url = "<?php echo url('Achievement/import_excel'); ?>";
            var index = layer.open({
                type: 1,
                area: ['300px', '90px'],
                fix: false,
                //不固定
                maxmin: false,
                shade: 0.3,
                title: '请选择导出方式',
                content: 'url',
                btn: ['全部', '已通过', '自定义'],
                // 弹层外区域关闭
                shadeClose: true,
                btn1: function (index, layero) {
                    layer.close(index);
                    var data = {
                        'cid': cid,
                        'status': -1
                    };
                    $.ajax({
                        url: url,
                        data: data,
                        type: "POST",
                        dataType: 'JSON',
                        success: function (res) {
                            if (res.code == 0) {
                                redirect_url(res.url);
                                return layer.msg(res.msg, { icon: 1, time: 900 });
                            } else {
                                return layer.msg(res.msg, { icon: 2, time: 900 });
                            }

                        },
                    });
                },
                btn2: function (index, layero) {
                    layer.close(index);
                    var data = {
                        'cid': cid,
                        'status': 0
                    };
                    $.ajax({
                        url: url,
                        data: data,
                        type: "POST",
                        dataType: 'JSON',
                        success: function (res) {
                            if (res.code == 0) {
                                redirect_url(res.url);
                                return layer.msg(res.msg, { icon: 1, time: 900 });
                            } else {
                                return layer.msg(res.msg, { icon: 2, time: 900 });
                            }

                        },
                    });
                },
                btn3: function (index, layero) {
                    layer.close(index);
                    redirect_url("<?php echo url('Achievement/custom_import'); ?>?cid=" + cid);
                }
            });

        }

        // 重定向
        function redirect_url(url) {
            window.location.href = url;
        }
    </script>

</body>

</html>